<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>2</title>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
	<button onclick="javascript:alert($(window.top.document).find('#testIframe').attr('myid'));alert($(window.top.document).find('#testDiv').data('myid'))">获取</button>
</body>
</html>